package com.ztc.util.sms;

public enum SMSResult {
    SUCCESS(100, "发送成功"), VALIDATION_FAILS(101, "验证失败"), NOT_ENOUGH(102, "短信不足"), FAIL(103, "操作失败"), ILLEGAL_CHARACTER(104, "非法字符"), OUTLINE_MORE(105, "内容过多"), MOBILE_MORE(106, "号码过多"), CHANGES_FREQUENT(107, "频率过快"), MOBILE_OR_OUTLINE_NULL(108, "号码内容空"), ACCOUNT_FREEZE(109,
            "账号冻结"), SEND_FREQUENT(110, "禁止频繁单条发送"), TENTATIVELY_SENT(111, "系统暂定发送"), MOBILE_ERROR(112, "号码错误"), TIME_ERROR(113, "定时时间格式不对"), ACCOUNT_LOCK(114, "账号被锁，10分钟后登录"), CONNECTION_FAILED(115, "连接失败"), PROHIBIT_SEND(116, "禁止接口发送"), IP_ERROR(117, "绑定IP不正确"), SYSTEM_UPGRADE(120, "系统升级");

    //返回的码表，对应内容如上枚举
    private int code;
    private String text;

    SMSResult(int code, String text) {
        this.code = code;
        this.text = text;
    }

    public int getCode() {
        return code;
    }

    public String getText() {
        return text;
    }

    public static SMSResult parse(Integer code) {
        for (SMSResult result : values()) {
            if (result.code == code) {
                return result;
            }
        }
        return null;
    }

    @Override
    public String toString() {
        return ("send error code:" + code + " send error text:" + text);
    }
}
